package iterator;

/**
 * @author zhangxi
 * @date 2021/9/29
 */
public class ClassRoom implements Aggregate {

    private Student[] students;

    private int last = 0;


    public ClassRoom(int size) {
        this.students = new Student[size];
    }

    public Student getStudent(int index) {
        return students[index];
    }

    public void addStudent(Student student) {
        students[last] = student;
        last++;
    }


    public int getLength() {
        return last;
    }

    public Interator interator() {
        return new ClassRoomInterator(this);
    }
}
